npm-bundle fails with Error: ENOENT: no such file or directory, open 'package.json'
for my NodeJs project. If I create test.js
, package.json
file manually and run npm install
and then npm-bundle
it works fine as expected. When I run npm-bundle
for my existing project it fails. I have checked and all node_modules
, package.json
and package-lock.json
exists in the project. How can I debug this issue?
username$npm-bundle --verbose
/Users/username/.nvm/versions/node/v14.19.3/lib/node_modules/npm-bundle/bin/cli.js:11
throw error
^
[Error: ENOENT: no such file or directory, open 'package.json'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: 'package.json'
}
CodePudding user response:
Is your package.json
file in the root of your project?
I find it helpful to run npm init
when creating a new Node project instead of manually creating the package.json
file.
CodePudding user response:
In package.json
the name field had @namespace/package-name
which was causing issue, changing it to just "name": "package-name"
worked.