Error: require.paths is removed. Use node_modules folders, or the NODE_PATH environment variable instead

前端 未结 2 1150
野趣味
野趣味 2021-01-12 10:33

I just freshly installed Node.js and now I\'m trying to run a simple script, but I get the following error message:

Error: require.paths is removed. Use node         


        
相关标签:
2条回答
  • 2021-01-12 10:48

    In my case, I have an old local (user-specific) installation of coffee-script.

    Here's what I did :

    1. deleted my ~/.node_modules folder
    2. deleted relevant binaries in ~/bin folder
    3. reinstall coffee-script : sudo npm install --global coffee-script

    Now it works :)

    0 讨论(0)
  • 2021-01-12 10:52

    This error happens when some installed packages are built for an older version of nodejs.

    Which version of node are you using?

    $ node -v
    

    Are you using npm (http://npmjs.org) to install packages? The output of install express should be like this:

    $ npm install express
    npm http GET https://registry.npmjs.org/express
    npm http 200 https://registry.npmjs.org/express
    npm http GET https://registry.npmjs.org/mime/1.2.4
    npm http GET https://registry.npmjs.org/mkdirp/0.3.0
    npm http GET https://registry.npmjs.org/qs
    npm http GET https://registry.npmjs.org/connect
    npm http 304 https://registry.npmjs.org/mime/1.2.4
    npm http 304 https://registry.npmjs.org/mkdirp/0.3.0
    npm http 304 https://registry.npmjs.org/qs
    npm http 200 https://registry.npmjs.org/connect
    npm http GET https://registry.npmjs.org/connect/-/connect-1.9.0.tgz
    npm http 200 https://registry.npmjs.org/connect/-/connect-1.9.0.tgz
    npm http GET https://registry.npmjs.org/formidable
    npm http 304 https://registry.npmjs.org/formidable
    express@2.5.10 ./node_modules/express
    ├── qs@0.4.2
    ├── mkdirp@0.3.0
    ├── mime@1.2.4
    └── connect@1.9.0 (formidable@1.0.11)
    
    0 讨论(0)
提交回复
热议问题