Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm start, Error: Cannot find module '%NODE_ARGS%' #16452

Closed
pybala opened this issue Jul 21, 2017 · 10 comments · Fixed by #19242
Closed

npm start, Error: Cannot find module '%NODE_ARGS%' #16452

pybala opened this issue Jul 21, 2017 · 10 comments · Fixed by #19242
Assignees

Comments

@pybala
Copy link

pybala commented Jul 21, 2017

Platform: Windows
Node: 6.11.1
npm: 3.10.10

    Asset     Size  Chunks                    Chunk Names
bundle.js  4.22 MB       0  [emitted]  [big]  main

bundle.js.map 5.39 MB 0 [emitted] main
[15] ./server/config/index.js 858 bytes {0} [built]
[639] ./package.json 11.7 kB {0} [built]
[640] ./index.js 1.54 kB {0} [built]
[641] ./server/boot/index.js 1.98 kB {0} [built]
[642] ./server/build/index.js 1.48 kB {0} [built]
[644] ./server/config/parser.js 1.79 kB {0} [built]
[645] ./client/lib/create-config/index.js 2.65 kB {0} [built]
[647] ./server/pages/index.js 13.9 kB {0} [built]
[1209] ./server/isomorphic-routing/index.js 3.67 kB {0} [built]
[1764] ./server/pages/analytics.js 1.63 kB {0} [built]
[1767] ./server/user-bootstrap/index.js 1.4 kB {0} [built]
[1770] ./server/bundler/index.js 2.97 kB {0} [built]
[1776] ./server/devdocs/index.js 8.3 kB {0} [built]
[1790] ./server/api/index.js 457 bytes {0} [built]
[1791] ./server/api/oauth.js 2.7 kB {0} [built]
+ 1780 hidden modules
Time: 41s 87.520ms
openssl config failed: error:02001003:system library:fopen:No such process
openssl config failed: error:02001003:system library:fopen:No such process
openssl config failed: error:02001003:system library:fopen:No such process
openssl config failed: error:02001003:system library:fopen:No such process
module.js:471
throw err;
^

Error: Cannot find module 'C:\Apps\blogs-calypso%NODE_ARGS%'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
events.js:160
throw er; // Unhandled 'error' event
^

Looks like it is because of "docs" files.
What could be the issue?

Thanks,
Bala

@pybala pybala changed the title Error: Cannot find module '%NODE_ARGS%' npm start, Error: Cannot find module '%NODE_ARGS%' Jul 21, 2017
@designsimply designsimply added Build [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Type] Help Request labels Jul 21, 2017
@pybala
Copy link
Author

pybala commented Jul 24, 2017

Did anyone had a chance to review this issue? your help is deeply appreciated.

@designsimply
Copy link
Contributor

Looks like it is because of "docs" files.

(Out of curiosity) why do you think it's because of "docs" files?

I searched for the error you mentioned on Google:

openssl config failed: error:02001003:system library:fopen:No such process

And I found an open issue in the npm repository with that exact error. Is it the same as your issue? See npm/npm#17261

@pybala
Copy link
Author

pybala commented Jul 25, 2017

@designsimply, the first time when I tried this application, I was trying with all the latest versions.. I mean node v8. That time also I encountered the same error at same line, but there were no openssl error.

I thought it could be because of not using the recommended versions, then I tried reinstalling the calypso with 6.11.1, and this time also got the same along with openssl errors.

Thanks,
Bala

@pybala
Copy link
Author

pybala commented Jul 25, 2017

@designsimply, I referred the issue you mentioned, after setting the ssl config to null, i'm not getting any openssl error, but still it throws the same error at same line.

Pasting the complete output here.

C:\Apps\Bala\blogs-calypso>npm start

> wp-calypso@0.17.0 prestart C:\Apps\Bala\blogs-calypso
> npm run -s install-if-deps-outdated && node bin/welcome.js && ( check-node-version --package || exit 0 )

             _
    ___ __ _| |_   _ _ __  ___  ___
   / __/ _` | | | | | '_ \/ __|/ _ \
  | (_| (_| | | |_| | |_) \__ \ (_) |
   \___\__,_|_|\__, | .__/|___/\___/
               |___/|_|

node: 6.11.1
npm: 3.10.10
'yarn' is not recognized as an internal or external command,
operable program or batch file.

> wp-calypso@0.17.0 start C:\Apps\Bala\blogs-calypso
> npm run -s build

Rendering Complete, saving .css file...
Wrote CSS to C:\Apps\Bala\blogs-calypso\public\editor.css
Rendering Complete, saving .css file...
Wrote CSS to C:\Apps\Bala\blogs-calypso\public\directly.css
Rendering Complete, saving .css file...
Rendering Complete, saving .css file...
Wrote CSS to C:\Apps\Bala\blogs-calypso\public\style.css
Wrote Source Map to C:\Apps\Bala\blogs-calypso\public\style-debug.css.map
Wrote CSS to C:\Apps\Bala\blogs-calypso\public\style-debug.css
Saving: C:\Apps\Bala\blogs-calypso\public\style-rtl.css
Hash: 45855a6bd243f610ba17
Version: webpack 3.1.0
Time: 25312ms
        Asset     Size  Chunks                    Chunk Names
    bundle.js  8.61 MB       0  [emitted]  [big]  main
bundle.js.map  11.6 MB       0  [emitted]         main
  [15] ./server/config/index.js 858 bytes {0} [built]
 [639] ./package.json 11.7 kB {0} [built]
 [640] ./index.js 1.54 kB {0} [built]
 [641] ./server/boot/index.js 1.98 kB {0} [built]
 [642] ./server/build/index.js 1.48 kB {0} [built]
 [644] ./server/config/parser.js 1.79 kB {0} [built]
 [645] ./client/lib/create-config/index.js 2.65 kB {0} [built]
 [647] ./server/pages/index.js 13.9 kB {0} [built]
[1209] ./server/isomorphic-routing/index.js 3.67 kB {0} [built]
[1764] ./server/pages/analytics.js 1.63 kB {0} [built]
[1767] ./server/user-bootstrap/index.js 1.4 kB {0} [built]
[1770] ./server/bundler/index.js 2.97 kB {0} [built]
[1776] ./server/devdocs/index.js 8.3 kB {0} [built]
[1790] ./server/api/index.js 457 bytes {0} [built]
[1791] ./server/api/oauth.js 2.7 kB {0} [built]
    + 1780 hidden modules
module.js:471
    throw err;
    ^

Error: Cannot find module 'C:\Apps\Bala\blogs-calypso\%NODE_ARGS%'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:389:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:504:3
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: spawn node ENOENT
    at notFoundError (C:\Apps\Bala\blogs-calypso\node_modules\cross-spawn\lib\enoent.js:11:11)
    at verifyENOENT (C:\Apps\Bala\blogs-calypso\node_modules\cross-spawn\lib\enoent.js:46:16)
    at ChildProcess.cp.emit (C:\Apps\Bala\blogs-calypso\node_modules\cross-spawn\lib\enoent.js:33:19)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: spawn cross-env ENOENT
    at notFoundError (C:\Apps\Bala\blogs-calypso\node_modules\cross-spawn\lib\enoent.js:11:11)
    at verifyENOENT (C:\Apps\Bala\blogs-calypso\node_modules\cross-spawn\lib\enoent.js:46:16)
    at ChildProcess.cp.emit (C:\Apps\Bala\blogs-calypso\node_modules\cross-spawn\lib\enoent.js:33:19)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)

npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.11.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! wp-calypso@0.17.0 start: `npm run -s build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wp-calypso@0.17.0 start script 'npm run -s build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the wp-calypso package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run -s build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs wp-calypso
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls wp-calypso
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Apps\Bala\blogs-calypso\npm-debug.log

@n-paredes
Copy link

@kumarbalap I have exactly the same problem in windows 10 64 bits.
Could be some issue of this calypso version?

node: 6.11.1 npm: 3.10.10 yarn: 0.27.5

`[..................] / : sill lifecycle wp-calypso@0.17.0env: Args: [ '[..................] / : sill lifecycle wp-calypso@0.17.0env: Args: [ '[..................] / : sill lifecycle wp-calypso@0.17.0build-server: [..................] / : sill lifecycle wp-calypso@0.17.0build-server: Time: 528s 486.280ms
[..................] / : sill lifecycle wp-calypso@0.17.0build-devdocs:[..................] / : sill lifecycle wp-calypso@0.17.0env: Args: [ '[..................] / : sill lifecycle wp-calypso@0.17.0~build-devdocs:module.js:471
throw err;
^

Error: Cannot find module 'C:\Users\np\SitiosWeb\wp-calypso%NODE_ARGS%'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
events.js:160
throw er; // Unhandled 'error' event
^

Error: spawn node ENOENT
at notFoundError (C:\Users\np\SitiosWeb\wp-calypso\node_modules\cross-spawn\lib\enoent.js:11:11)
at verifyENOENT (C:\Users\np\SitiosWeb\wp-calypso\node_modules\cross-spawn\lib\enoent.js:46:16)
at ChildProcess.cp.emit (C:\Users\np\SitiosWeb\wp-calypso\node_modules\cross-spawn\lib\enoent.js:33:19)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
events.js:160
throw er; // Unhandled 'error' event
^

Error: spawn cross-env ENOENT
at notFoundError (C:\Users\np\SitiosWeb\wp-calypso\node_modules\cross-spawn\lib\enoent.js:11:11)
at verifyENOENT (C:\Users\np\SitiosWeb\wp-calypso\node_modules\cross-spawn\lib\enoent.js:46:16)
at ChildProcess.cp.emit (C:\Users\np\SitiosWeb\wp-calypso\node_modules\cross-spawn\lib\enoent.js:33:19)
at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)

npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start"
npm ERR! node v6.11.1
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! wp-calypso@0.17.0 start: npm run -s build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wp-calypso@0.17.0 start script 'npm run -s build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the wp-calypso package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm run -s build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs wp-calypso
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls wp-calypso
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\np\SitiosWeb\wp-calypso\npm-debug.log`

@DanReyLop
Copy link
Contributor

There's a problem on the way Windows handles non-existent env variables. The workaround is to run this command before npm start:
set "NODE_ARGS= " (note the space after the =).
You'll need to run it again every time you open a new command prompt.

I'll fix that when I have some time to look at it, it looks like something cross-env should handle transparently.

@DanReyLop
Copy link
Contributor

In case someone else wants to take a stab at this issue, here's more context.

This line allows running npm start with any arbitrary NodeJS CLI flags, like:
NODE_ARGS="--debug-brk" npm start

The poststart is parsed by cross-env, so in a UNIX environment, this is executed:
node $NODE_ARGS build/bundle.js
Which, at runtime, it's evaluated to:
node --debug-brk build/bundle.js

And in Windows:
node %NODE_ARGS% build/bundle.js
Which in runtime is evaluated to:
node --debug-brk build/bundle.js

So everything works fine when NODE_ARGS has some value. The problem is that UNIX and Windows treat non-existent env vars differently. In UNIX, a non-existent env var is the same as an empty string, while in Windows an empty var is the same as its own name. So when running npm start without setting any value for NODE_ARGS, this is evaluated in UNIX:
node build/bundle.js
And this is run in Windows:
node %NODE_ARGS% build/bundle.js
So it's interpreted as Use the node interpreter to run this "%NODE_ARGS%" script, which it's obviously incorrect.

@pybala
Copy link
Author

pybala commented Jul 26, 2017

@DanReyLop thank you, setting empty NODE_ARGS solved the problem, proceeding with the rest of the things.

@pybala pybala closed this as completed Jul 26, 2017
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jul 26, 2017
@DanReyLop
Copy link
Contributor

DanReyLop commented Jul 26, 2017

@kumarbalap I'll leave this open for now. I gave you a hacky workaround but the problem must be fixed :)

@DanReyLop DanReyLop reopened this Jul 26, 2017
@DanReyLop DanReyLop self-assigned this Jul 26, 2017
This was referenced Oct 24, 2017
DanReyLop pushed a commit that referenced this issue Oct 27, 2017
…mmands in Windows with undefined env variables

Fixes #16452
Closes #19084

The latest version of `cross-env` (`5.1.1`) includes a fix to #16452.
The fix is: kentcdodds/cross-env#149
Now the behaviour of commands like `cross-env node $UNDEFINED_VAR index.js` is expanding the variable
to the empty string, both in Windows and in UNIX.

To get the new version of `cross-env` working, I had to change all `cross-env` commands to `cross-env-shell`,
as this was a breaking change on `cross-env@5`.

To test: run `npm start` on a Windows `cmd.exe` shell, check that it works.

cc/ @Viper007Bond @withinboredom
DanReyLop pushed a commit that referenced this issue Nov 2, 2017
…ommands in Windows with undefined env variables

Fixes #16452
Closes #19084

The latest version of `cross-env` (`5.1.1`) includes a fix to #16452.
The fix is: kentcdodds/cross-env#149
Now the behaviour of commands like `cross-env node $UNDEFINED_VAR index.js` is expanding the variable
to the empty string, both in Windows and in UNIX.

To get the new version of `cross-env` working, I had to change all `cross-env` commands to `cross-env-shell`,
as this was a breaking change on `cross-env@5`.

To test: run `npm start` on a Windows `cmd.exe` shell, check that it works.

cc/ @Viper007Bond @withinboredom
DanReyLop pushed a commit that referenced this issue Nov 16, 2017
…ommands in Windows with undefined env variables

Fixes #16452
Closes #19084

The latest version of `cross-env` (`5.1.1`) includes a fix to #16452.
The fix is: kentcdodds/cross-env#149
Now the behaviour of commands like `cross-env node $UNDEFINED_VAR index.js` is expanding the variable
to the empty string, both in Windows and in UNIX.

To get the new version of `cross-env` working, I had to change all `cross-env` commands to `cross-env-shell`,
as this was a breaking change on `cross-env@5`.

To test: run `npm start` on a Windows `cmd.exe` shell, check that it works.

cc/ @Viper007Bond @withinboredom
DanReyLop pushed a commit that referenced this issue Nov 17, 2017
…ommands in Windows with undefined env variables

Fixes #16452
Closes #19084

The latest version of `cross-env` (`5.1.1`) includes a fix to #16452.
The fix is: kentcdodds/cross-env#149
Now the behaviour of commands like `cross-env node $UNDEFINED_VAR index.js` is expanding the variable
to the empty string, both in Windows and in UNIX.

To get the new version of `cross-env` working, I had to change all `cross-env` commands to `cross-env-shell`,
as this was a breaking change on `cross-env@5`.

To test: run `npm start` on a Windows `cmd.exe` shell, check that it works.

cc/ @Viper007Bond @withinboredom
@yogesh889
Copy link

'BROWSERSLIST_ENV' is not recognized as an internal or external command.
I am getting this error again and again, please help me regarding this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants