Just installed parcel-bundler with yarn and started it from CLI. It immediately thrown an error (node:68513) UnhandledPromiseRejectionWarning: Error: Cannot find module './assets/RawAsset'. Taking a look at the sources of node_modules/parcel-bundler/src actually shows no presence of assets directory. The version in package.json of parcel-bundler is 1.8.1.
The detailed stack trace is:
(node:68513) UnhandledPromiseRejectionWarning: Error: Cannot find module './assets/RawAsset'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (/Users/shybovycha/projects/javascript/my-calorie-counter/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at Object.<anonymous> (/Users/ashubovych/projects/javascript/my-calorie-counter/node_modules/parcel-bundler/src/Parser.js:2:18)
at Module._compile (/Users/ashubovych/projects/javascript/my-calorie-counter/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
(node:68513) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:68513) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Tried different versions, including 1.8.0, 1.7.1 and 1.7.0, but neither worked.
Strangely enough, when using NPM - everything works just fine. So this is probably caused by some odd Yarn behavior.
My package.json has this dependency (generated by yarn automatically):
{
"parcel-bundler": "^1.8.1",
}
My server/public/index.html (entry point) looks like this:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Packed - Calorie Counter: React</title>
<script src="../../client/index.jsx"></script>
</head>
<body>
<div id="root"></div>
</body>
</html>
The React application is stored in client/ directory, but that probably does not matter for this case.
I am using ./node_modules/.bin/parcel server/public/index.html to run parcel.
Successfull build..?
๐ฅ
๐คทโโ๏ธ
This is the project where I try to adopt parcel: https://github.com/shybovycha/my-calorie-counter/tree/migrate-to-parcel
To build it, run yarn build (this fails as for now).
| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.8.1 |
| Node | 10.3.0 |
| npm/Yarn | [email protected] [email protected] |
| Operating System | OSX 10.13.4 |
So the problem was indirect - I had the .yarnclean file, which somehow appeared in my project, which had a single line: assets, which recursively matched all the directories in all the dependencies when they were installed and thus was removing parcel-bundler/src/assets.
Removing the file solves the issue.
Unfortunately I'm having this issue now and removing the .yarnclean file did not solve it :(
@adnelson me too, and, I upgraded from Typescript 3.5 to 3.6, seems to have solved the problem:
$ npx parcel index.ts
(node:20570) UnhandledPromiseRejectionWarning: Error: Cannot find module './assets/RawAsset'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:668:15)
at Function.Module._load (internal/modules/cjs/loader.js:591:27)
at Module.require (internal/modules/cjs/loader.js:723:19)
at require (/home/user/styd/d9/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at Object.<anonymous> (/home/user/styd/d9/node_modules/parcel-bundler/src/Parser.js:3:18)
at Module._compile (/home/user/styd/d9/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
at Module.load (internal/modules/cjs/loader.js:685:32)
at Function.Module._load (internal/modules/cjs/loader.js:620:12)
at Module.require (internal/modules/cjs/loader.js:723:19)
Then: vi package.json
- "typescript": "^3.5",
+ "typescript": "^3.6.4",
And download the new version: yarn add --dev typescript
Thereafter:
$ npx parcel index.ts
Server running at http://localhost:1234
โจ Built in 1.54s.
^C
Unfortunately I'm having this issue now and removing the
.yarncleanfile did not solve it :(
just in case. you need to remove&add parcel-builder after removing autoclean file
Most helpful comment
So the problem was indirect - I had the
.yarncleanfile, which somehow appeared in my project, which had a single line:assets, which recursively matched all the directories in all the dependencies when they were installed and thus was removingparcel-bundler/src/assets.Removing the file solves the issue.