I'm attempting to use webstorm for a new project and use yarn instead of npm. However, after generating the project I can't get the scripts to run via yarn. My start script has the following run configuration in WebStorm.
package.json: ~/dev/starting_sandbox/package.json
Command: run
Scripts: start
Node Interpreter: ~/.nvm/versions/node/v7.8.0/bin/node
Npm package: ~/.nvm/versions/node/v7.8.0/lib/node_modules/yarn
~~~
When this runs I get an error:
/Users/byronsm/.nvm/versions/node/v7.8.0/bin/node /Users/byronsm/.nvm/versions/node/v7.8.0/lib/node_modules/yarn/bin/yarn.js run start
yarn run v0.21.3
$ react-scripts start
~/dev/starting_sandbox/node_modules/cross-spawn/index.js:34
throw new Error(
^
Error: In order to use spawnSync on node 0.10 or older, you must install spawn-sync:
npm install spawn-sync --save
at Function.spawnSync [as sync] (~/dev/starting_sandbox/node_modules/cross-spawn/index.js:34:19)
at Object.<anonymous> (~/dev/starting_sandbox/node_modules/react-scripts/bin/react-scripts.js:22:22)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:929:3
error Command failed with exit code 8.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I was able to solve this problem in webpack when running the scripts via npm by using the --scripts-prepend-node-path
option. However, this doesn't seem to exist for yarn.
This seems to be an issue with the instance of node that yarn runs when executing the scripts, instead of pulling from the same node binary used to execute yarn itself, it uses what it finds in $PATH, which isn't modified.
Is there a similar command you can use for yarn?
via Krustal
No comments:
Post a Comment